#include <bits/stdc++.h>
using namespace std;
int a[1000001];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1);

  int q;
  cin >> q;
  while (q--) {
    int age;
    cin >> age;
    int k = lower_bound(a + 1, a + n + 1, age) - a;
    // cout << k << endl;
    cout << n - (k - 1) << endl;
  }

  return 0;
}